package com.example8.xxl_job_module.custom_demo.job;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Description 手动注册任务
 * @Author lihw
 * @Date 2023/12/19 8:40
 */
@Slf4j
@Component
public class JobGlueBean {

    public void init() {
        log.info("job JobGlueBean init");
    }

    public void destroy() {
        log.info("job JobGlueBean destroy");
    }

    @XxlJob(init = "init", value = "demoJobGlueHandler1",destroy = "destroy")
    public void demoJobGlueHandler1() {
        XxlJobHelper.log(">>>>>>>>>>>>>>>开始执行 demoJobGlueHandler1 ");
        // log.info("demoJobGlueHandler1 execut");
        XxlJobHelper.log(">>>>>>>>>>>>>>>结束执行 demoJobGlueHandler1 ");

        XxlJobHelper.handleSuccess("demoJobGlueHandler1 执行成功");
    }

}
